home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.3 / Video Toaster v4.3.iso / 4.2 / arexx / editor / batchstills.rexx next >
OS/2 REXX Batch file  |  1998-04-16  |  4KB  |  145 lines

  1. /* BatchStills.rexx V2.0 -- Convert a Directory of framestores or IFF's */
  2. /* or FrameStores into flyer Stills.                                    */
  3. /* By Bob Caron (Grue) © 1995 NewTek Inc.                               */
  4.  
  5. OPTIONS RESULTS
  6. call remlib('PROJECT_REXX_PORT')
  7. call remlib('ToasterARexx.port')
  8. call remlib('rexxsupport.library')
  9.  
  10. call ADDLIB("rexxsupport.library", 0,-30,0)
  11. call addlib('PROJECT_REXX_PORT', 0)
  12. call addlib('ToasterARexx.port',0)
  13.  
  14. call set_view(2)
  15. call req_error("Batch Stills V3.0     ---    Convert a directory of framestores to flyer stills.")
  16.  
  17. call startfilereq("Location Of Framestores","toaster:framestore","(No Filename)")
  18.  
  19. exit=1
  20. do while exit=1
  21.   file=queryfilereq()
  22.   if file=0 then call quit
  23.   if file~="" then exit=0
  24.   address command "c:wait 1"
  25. end
  26.  
  27. if lastpos('/',file,length(file)-1)~=0 then do
  28.    filenam=right(file,(length(file)-lastpos('/',file,length(file)-1)))
  29.    path=left(file,(lastpos('/',file,length(file))-1))
  30.    end
  31. else do
  32.    filenam=right(file,(length(file)-lastpos(':',file,length(file)-1)))
  33.    path=left(file,(lastpos(':',file,length(file))))
  34.    end
  35.  
  36. call startfilereq("Save Stills To What Flyer Drive?","FA0:","(No Filename)")
  37.  
  38. exit=1
  39. do while exit=1
  40.   fpath=queryfilereq()
  41.   if fpath=0 then call quit
  42.   if fpath~="" then exit=0
  43.   address command "c:wait 1"
  44. end
  45.  
  46. if lastpos('/',fpath,length(fpath)-1)~=0 then do
  47.    filenam2=right(file,(length(fpath)-lastpos('/',fpath,length(fpath)-1)))
  48.    path2=left(fpath,(lastpos('/',fpath,length(fpath))-1))
  49.    end
  50. else do
  51.    filenam2=right(fpath,(length(fpath)-lastpos(':',fpath,length(fpath)-1)))
  52.    path2=left(fpath,(lastpos(':',fpath,length(fpath))))
  53.    end
  54.  
  55. call pragma("D",path2)
  56. fpath=pragma("D","RAM:")
  57.  
  58. if (right(fpath,1)~="/") & (right(fpath,1)~=":") then
  59.    fpath=fpath||"/"
  60.  
  61.  
  62. if pragma('d',path||filenam)="" then file=path
  63. else file=path||filenam
  64.  
  65.   dir = showdir(path ,'f','*')
  66.   test=translate(dir,'?',' ','?')
  67.   test2=translate(test,' ','*',' ')
  68.   dir = test2
  69.  
  70. call req_error("Note: HQ-5 selection will only work if HQ-5 is turned on in the options panel.")
  71.  
  72. compression=-1
  73. buttons='000'
  74. do while compression=-1
  75.   buttons=req_buttons("Choose Compression:",buttons,"HQ-5","Standard","Extended")
  76.   if buttons="CANCEL" then call quit
  77.  
  78.   if buttons="100" then do
  79.      compression=3
  80.      end
  81.   if buttons="010" then do
  82.      compression=0
  83.      end
  84.   if buttons="001" then do
  85.      compression=1
  86.      end
  87. end
  88.  
  89. if req_tell("Still want to continue?")=0 then call quit
  90.  
  91. loopto=words(dir)
  92. loop=1
  93. call req_open("Working... Please Wait.")
  94. badframes=0
  95. do while (loop<loopto+1)
  96.    frame=translate(word(dir,loop),' ','?')
  97.    call req_error("Converting "||frame||"...")
  98.    if goodframe(path||"/"||frame)=1 then do
  99.       Switcher(MDV1)
  100.       Switcher(PDV1)
  101.       Switcher(LRGB,path||"/"||frame,0)
  102.       call req_close()
  103.       call req_open("Working... Please Wait.")
  104.       call req_error("Converting "||frame||"...")
  105.       call recordadd(fpath||frame,4,6,compression)
  106.       call makeicon(fpath||frame,1,STILL)
  107.       end
  108.    else badframes=badframes+1
  109.    loop=loop+1
  110. end
  111. call req_close()
  112. if badframes>0 then call req_error("All done. (Note: "||badframes||" Non-IFF files were skipped.)")
  113. if badframes=0 then call req_error("All done.")
  114. call remlib('ToasterARexx.port')
  115. call remlib('PROJECT_REXX_PORT')
  116. exit
  117.  
  118. goodframe:
  119. parse arg filename
  120. if upper(right(filename,2))=".I" then do
  121.    badframes=badframes-1
  122.    return 0
  123.    end
  124. return checkilbm(filename)
  125.  
  126. quit: PROCEDURE
  127.    call req_error("Canceled.")
  128.    call remlib('ToasterARexx.port')
  129.    call remlib('PROJECT_REXX_PORT')
  130.    exit
  131.  
  132. error:
  133. /* ignore errors */
  134. return
  135.  
  136. checkilbm:
  137. parse arg file
  138. if exists(file) then do
  139.     if open('infile',file,'READ') then do
  140.        filestart = readch('infile',12)
  141.        call close('infile')
  142.        if right(filestart,4)="ILBM" then return 1
  143.     end
  144. end
  145. return 0